<?php
    include_once '../connection/databaseHandler.php';
    include_once '../connection/sessionHandler.php';
    $database = new DatabaseHandler();
    $session = new SessionHandler();
    
    // cek dahulu apakah last received message telah terdaftar pada database
    // kalau belum, tambahkan
    $dbchatreceived = $database->t_chatreceived;

    $query  = "UPDATE ".$dbchatreceived." SET timestamp=NOW() WHERE username='".$session->username."'";
    $result = $database->execQuery($query);

    $session->destroySession();
    header("location:../index.php");
?>
